#include "netPackDefine.h"
#include "NetDataManager.h"
#include <QDataStream>
#include <QFile>
#include <QImage>
#include <QApplication>
#include "PackDefine.h"

//NetPackVariant
NetPackVariant::NetPackVariant()
{	
}

bool NetPackVariant::pack(QByteArray &buffer) const
{	
	QDataStream s(&buffer, QIODevice::WriteOnly);
	s.writeRawData(data.data(), data.size());
	return true;
}

bool NetPackVariant::unPack(const QByteArray &buffer)
{
	Q_ASSERT(buffer.size() == info.bodyLength());
	data = buffer;
	return true;
}

void NetPackRegist()
{
	NetPackManager::instance()->registPack<NetPackVariant>();	
}